package com.appsky.drift.dialog;

import java.util.ArrayList;
import java.util.Collection;

import com.appsky.drift.R;
import com.appsky.drift.adapter.RoomPersonListAdapter;
import com.appsky.drift.api.AppSkyApp;
import com.appsky.drift.api.UserInfo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.widget.BaseAdapter;

public class RoomPersonListDialog extends AlertDialog.Builder {

	private AppSkyApp app = null;

	public RoomPersonListDialog(Context context) {
		super(context);

		app = (AppSkyApp) ((Activity) context).getApplication();

		setTitle(R.string.room_person_list);
		Collection<UserInfo> infoList = new ArrayList<UserInfo>();
		infoList.addAll(app.myInfo.getRoomPersons().values());
		BaseAdapter roomPersonAdapter = new RoomPersonListAdapter(context,
				(ArrayList<UserInfo>) infoList);
		setAdapter(roomPersonAdapter, null);

		setPositiveButton(R.string.ok, new OnClickListener() {

			@Override
			public void onClick(DialogInterface dialog, int which) {

			}
		});

	}

}
